<?php 
include('header.php');
include('menu.php');
include('config.php');
include_once('connection/connection.php');
$District_id=$_REQUEST['DT'];
$Block_id=$_REQUEST['BC'];
$type_scheme=$_REQUEST['TS'];
if($type_scheme=='P')
	{
	$type_scheme='P&T';
	}
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/validate.js"></script>
<script language="javascript" type="text/javascript">
function validate()
{
	valid = true;
	if (document.view_main_q1.district.selectedIndex == 0)
    {
        alert ( "Please select District Name" );
        valid = false;
    }
	if (document.view_main_q1.form_id.selectedIndex == 0)
    {
        alert ( "Please select Form Id" );
        valid = false;
    }
	return valid;
}	
</script>
<title> P&T </title>
</head>
<body>
<div align="center">
<form action="" method="post" enctype="multipart/form-data" onSubmit="return validate()" name="view_main_q1">
	<table border="0" width="746" id="table1" cellspacing="0" cellpadding="0" style="padding:10px;">
	<tr>
		<td height="29" align="left" valign="top" bgcolor="#C5D8EB" colspan="7">&nbsp;</td>
	</tr>
	<tr>
	<td bgcolor="#E5E5E5" align="center" colspan="7">
	<span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size: 8.5pt"><font face="Verdana" color="#006699"><b>HP scheme wise list</b></font></span></td>
</tr>
<tr><td bgcolor="#E5E5E5" align="left" colspan="7">&nbsp;</td>
</tr>
<tr><td width="60" height="35" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>District</b></font></td>
  <td width="131" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo getName('district',$District_id);?></font></td>
  <td width="52" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Block</b></font></td>
  <td width="137" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo getName('block',$Block_id);?></font></td>
  <td width="64" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Scheme</b></font></td>
  <td width="151" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000">HP</td>
  <td width="151" align="right"><a href="schemewiseListHP.php"><font face="Verdana" style="font-size: 8.5pt" color="#993333"><b>Back</b></font></a></td>
</tr>
		
		<tr>
			<td colspan="7">
			
<table width="743" bgcolor="#FFFFFF" style="border:1px solid #999999">
  <tr bgcolor="#E5E5E5">
    <td width="44" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Sr.No.</font></td>
    <td width="223" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Gram Panchayat</font></td>
    <td width="133" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Census Village Code</font></td>
    <td width="274" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Village</font><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;</font></td>
    <td width="45" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;View</font></td>
  </tr>
 <?php
 //echo "select DISTINCT village_id,id from tbl_dtls_q2_main where district_id='$District_id' and block_id='$Block_id'";
$result=mysql_query("select DISTINCT village_id,id,panchayat_id,census_vil_code from tbl_dtls_q2_main where district_id='$District_id' and block_id='$Block_id'");
     $i=1;
    while($fetchedRow=mysql_fetch_array($result))
	  {
     $villageId=$fetchedRow['village_id'];
	 $q2Id=$fetchedRow['id'];
	 $panchayat_id=$fetchedRow['panchayat_id'];
	 $census_vil_code=$fetchedRow['census_vil_code'];        
 ?>
  <tr>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $i;?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo getName('panchayat',$panchayat_id);?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $census_vil_code;?></font></td>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo getName('village',$villageId);?></font><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;</font></td>
    <td style="border:1px solid #999999" align="center"><a href="q2.php?form_id=<?php echo $q2Id;?>" style="text-decoration:none"><img src="images/index.jpeg" width="16" height="16" border="0"></a></td>
  </tr>
  <?php
  $i++;
  }
  ?>
</table>			</td>
		</tr>
		<tr>
			<td colspan="7">&nbsp;</td>
		</tr>
	</table>
</form>
</div>
</body>
</html>
